cmake_minimum_required(VERSION 3.0)
project(gnodroid C)
set(CMAKE_C_STANDARD 99)

find_package(PkgConfig)

#添加gtk依赖
pkg_check_modules(GTK REQUIRED gtk+-3.0)
include_directories(${GTK_INCLUDE_DIRS})
link_libraries(${GTK_LIBRARIES})

#添加json-glib依赖
pkg_check_modules(JSON_GLIB REQUIRED json-glib-1.0)
include_directories(${JSON_GLIB_INCLUDE_DIRS})
link_libraries(${JSON_GLIB_LIBRARIES})

include_directories(${CMAKE_SOURCE_DIR}/header)

#编译资源文件
add_custom_command(OUTPUT gndresources.c
    COMMAND glib-compile-resources --generate-source --target=${CMAKE_BINARY_DIR}/gndresources.c  gndresources.gresource.xml
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/resource)

#扫描源文件
aux_source_directory(src SRC)
list(REMOVE_ITEM SRC main.c)

#添加各module源文件
add_subdirectory(${CMAKE_SOURCE_DIR}/src/module/gndinitmodule)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/module/gnddeviceinfomodule)
add_subdirectory(${CMAKE_SOURCE_DIR}/src/module/gndscreencapmodule)
#编译
add_library(gnd ${SRC})
#可执行文件
add_executable(gnodroid src/main.c gndresources.c)
#链接
target_link_libraries(gnodroid gnd)

#单元测试
add_subdirectory(test)
